<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>角色用户设置</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>
 
<ui:param name="bean" value="#{roleUserAction}" />

<h:body>
	<h:form id="rlist">
		<p:panel id="panel1" header="已选角色列表" style="text-align:center; margin:5%;">
			<p:dataTable id="dlist" var="role" value="#{bean.roleList}"
				resizableColumns="true" paginator="true" rows="20">
				<p:column headerText="标识" style="text-align:center" width="15%">
					<h:outputText value="#{role.id}" readonly="true"
						styleClass="text-align:center" />
				</p:column>
				<p:column headerText="角色名" style="text-align:center" width="15%">
					<h:outputText value="#{role.name}" styleClass="text-align:center" />
				</p:column>
				<p:column headerText="描述" style="text-align:center" width="40%">
					<h:outputText value="#{role.description}" styleClass="inputText"
						style="text-align:center" />
				</p:column>
			</p:dataTable>
		</p:panel>
	</h:form>
	<h:form id="ulist">
		<p:panel id="panel2" header="用户选择" style="text-align:center; margin:5%;">
			<p:panelGrid id="panel3">
				<p:row>
					<p:column width="40%">
						<p:dataTable id="dlist1" var="user" value="#{bean.leftList}"
							resizableColumns="true" paginator="true" rows="20" width="40%">
							<p:column headerText="选择" style="text-align:center" width="10%">
								<h:selectBooleanCheckbox value="#{bean.selected[user.id]}"  />
							</p:column>
							<p:column headerText="标识" style="text-align:center">
								<h:outputText value="#{user.id}" readonly="true"
									styleClass="text-align:center" />
							</p:column>
							<p:column headerText="角色名" style="text-align:center">
								<h:outputText value="#{user.username}"
									styleClass="text-align:center" />
							</p:column>
						</p:dataTable>
					</p:column>
					<p:column width="20%">
						<p:commandButton action="#{bean.select()}"   value="选择" update=":ulist" ajax="true"></p:commandButton>
						<p:commandButton action="#{bean.unSelect()}" value="取消" update=":ulist" ajax="true"></p:commandButton>
					</p:column>
					<p:column width="40%">
						<p:dataTable id="dlist2" var="user" value="#{bean.rightList}"
							resizableColumns="true" paginator="true" rows="20" width="40%">
							<p:column headerText="选择" style="text-align:center" width="10%">
								<h:selectBooleanCheckbox value="#{bean.unselected[user.id]}"  />
							</p:column>
							<p:column headerText="标识" style="text-align:center">
								<h:outputText value="#{user.id}" readonly="true"
									styleClass="text-align:center" />
							</p:column>
							<p:column headerText="角色名" style="text-align:center">
								<h:outputText value="#{user.username}"
									styleClass="text-align:center" />
							</p:column>
						</p:dataTable>
					</p:column>
				</p:row>
			</p:panelGrid>
			<p:commandButton action="#{bean.save()}" value="保存"	 update=":ulist" ajax="true" icon="ui-icon-star"></p:commandButton>
		</p:panel>
	</h:form>
</h:body>
</html>